#pragma once
#include "frame.h"

#pragma pack(1)
class Buffer
{
public:
	uint8_t			buffer[1<<16];
	uint16_t		length;
	uint8_t*const   data;
	uint8_t*const   user;
	time_t			last;
	Frame&			frame;
public:
	Buffer(void);
public:
	void	clear	(void);
	void	push	(uint8_t);
	void	pop		(void);
	bool	check	(void);
	bool	make	(void);
	bool	append	(void*,int);
	string  toString(void)const;
	uint16_t dataLength(void)const;
public:
	template<typename T>
	inline Buffer& operator<<(T o)
	{
		append(&o, o.length());
	}
};
#pragma pack(0)
